import 'package:flutter/material.dart';

/// EMPABEmployeeDepartment类 - 对应于员工部门信息
class EMPABEmployeeDepartment {

  // @override
  // String toString() {
  //   return 'EMPABEmployeeDepartment(id: $id, deptId: $deptId, dutyName: $dutyName, dutyLevel: $dutyLevel, '
  //       'sortNo: $sortNo, deptTreePath: $deptTreePath, phone: $phone, deptName: $deptName, '
  //       'deptFullName: $deptFullName, orgId: $orgId, companyName: $companyName, tel: $tel, '
  //       'companyId: $companyId, area: $area)';
  // }

  // 唯一标识符
  final String id;
  // 兼职部门id
  final String deptId;
  // 兼职部门内职位名称
  final String dutyName;
  // 职级
  final double dutyLevel;
  // 兼职部门内排序
  final int sortNo;
  // 产品版本6.3.0新增字段
  final String deptTreePath;
  final String phone;
  final String deptName;
  final String deptFullName;
  final String orgId;
  final String companyName;
  final String tel;
  final String companyId;
  // 行政区划
  final String area;

  EMPABEmployeeDepartment({
    required this.id,
    required this.deptId,
    required this.dutyName,
    required this.dutyLevel,
    required this.sortNo,
    required this.deptTreePath,
    required this.phone,
    required this.deptName,
    required this.deptFullName,
    required this.orgId,
    required this.companyName,
    required this.tel,
    required this.companyId,
    required this.area,
  });

  // 从JSON格式数据创建新的实例的工厂构造函数
  factory EMPABEmployeeDepartment.fromJson(Map<String, dynamic> json) {
    return EMPABEmployeeDepartment(
      id: json['id'],
      deptId: json['deptId'],
      dutyName: json['dutyName'],
      dutyLevel: json['dutyLevel'],
      sortNo: json['sortNo'],
      deptTreePath: json['deptTreePath'],
      phone: json['phone'],
      deptName: json['deptName'],
      deptFullName: json['deptFullName'],
      orgId: json['orgId'],
      companyName: json['companyName'],
      tel: json['tel'],
      companyId: json['companyId'],
      area: json['area'],
    );
  }

  // 将实例转换成JSON格式的方法
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'deptId': deptId,
      'dutyName': dutyName,
      'dutyLevel': dutyLevel,
      'sortNo': sortNo,
      'deptTreePath': deptTreePath,
      'phone': phone,
      'deptName': deptName,
      'deptFullName': deptFullName,
      'orgId': orgId,
      'companyName': companyName,
      'tel': tel,
      'companyId': companyId,
      'area': area,
    };
  }
}
